package com.lin.bean;

public class ZanList implements Comparable<ZanList>{
	String nickName;
	String photo;

	public ZanList() {

	}
	public ZanList(String nickName, String photo) {
		super();
		this.nickName = nickName;
		this.photo = photo;
	}
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	public String getPhoto() {
		return photo;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	@Override
	public int compareTo(ZanList another) {
		// TODO Auto-generated method stub
		if(another.getNickName().equals(getNickName()) && another.getPhoto().equals(getPhoto())) {
			return 0;
		} else {
			return 1;
		}
	}
	/*@Override
	public boolean equals(Object o) {
		// TODO Auto-generated method stub
		return super.equals(o);
	}
*/

    //重写equals方法, 最佳实践就是如下这种判断顺序:  
    public boolean equals(Object obj) {  
        if (!(obj instanceof ZanList))  
            return false;     
        if (obj == this)  
            return true;  
        return this.getNickName().equals(((ZanList) obj).getNickName()) && this.getPhoto().equals(((ZanList) obj).getPhoto());  
    }  
}